package com.jurenzhao.partssystem.information.cars.service;

import com.jurenzhao.partssystem.information.cars.dao.CarPartsMapper;
import com.jurenzhao.partssystem.information.cars.entity.CarParts;
import com.jurenzhao.partssystem.information.cars.entity.PartsType;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CarPartsService {
    @Resource
    private CarPartsMapper carPartsMapper;

    public List<CarParts> findAllCarParts(){
        return carPartsMapper.findAllCarParts();
    }
    public List<CarParts> findAllCarPartsByTypeId(int id){
        return carPartsMapper.findAllCarPartsByTypeId(id);
    }
    public List<CarParts> findAllCarPartsByName(String name){
        return carPartsMapper.findAllCarPartsByName(name);
    }
    //保存
    public int save(CarParts carParts){
        return carPartsMapper.insertSelective(carParts);
    }
    //通过id 查找配件信息
    public CarParts findAllCarPartsById(int id){
        return carPartsMapper.findAllCarPartsById(id);
    }
    //更新配件信息
    public int updateById(CarParts carParts){
        return carPartsMapper.updateByPrimaryKeySelective(carParts);
    }
    public List<CarParts> findAll(){
        return carPartsMapper.findAll();
    }
    public List<CarParts> SortByNumGao(){
        return carPartsMapper.SortByNumGao();
    }
    public List<CarParts> SortByNumDi(){
        return carPartsMapper.SortByNumDi();
    }
    public List<CarParts> SortByPriceGao(){
        return carPartsMapper.SortByPriceGao();
    }
    public List<CarParts> SortByPriceDi(){
        return carPartsMapper.SortByPriceDi();
    }
    public List<CarParts> SearchKeyword(String keyword){
        return carPartsMapper.SearchKeyword(keyword);
    }
    public int deleteCarParts(Integer id){
        return carPartsMapper.deleteByPrimaryKey(id);
    }

}
